Mapping IDL to Java |
5 |
![]() |
The rationale for design decisions can be found in Chapter 4, "Overall Design Rationale".
In addition, because of the nature of the Java language, a single IDL construct may be mapped to several (differently named) Java constructs. The "additional" names are constructed by appending a descriptive suffix. For example, the IDL interface foo is mapped to the Java interface foo
, and additional Java classes fooHelper
and fooHolder
.
In those exceptional cases that the "additional" names would conflict with other mapped IDL names, the resolution rule described above is applied to the other mapped IDL names. I.e., the naming and use of required "additional" names takes precedence.
IDL names that would normally be mapped unchanged to Java identifiers that conflict with Java reserved words will have the collision rule applied.
Helper
, where <type> is the name of IDL user defined type.
Holder
, where <type> is the name of an IDL defined type (with certain exceptions such as typedef aliases).
Holder
, where <basicJavaType> is one of the Java primitive datatypes that is used by one of the IDL basic datatypes (Section 5.4.1.2, "Holder Classes).
Package
, where <interface> is the name of an IDL interface (Section 5.15, "Mapping for Certain Nested Types).
_
) prepended.IDL declarations not enclosed in any modules are mapped into the (unnamed) Java global scope.
// IDL
module Example {...}
// generated Java
package Example;
...
Users should be careful when using unsigned types in Java. Because there is no support in the Java language for unsigned types, a user is responsible for ensuring that large unsigned IDL type values are handled correctly as negative integers in Java.
IDL Type |
Java type |
Exceptions |
IDL Type |
Java type |
Exceptions |
A future revision of this specification should make support of this mapping normative.
org.omg.CORBA
package and are generated for all named user defined types except those defined by typedefs.
For user defined IDL types, the holder class name is constructed by appending Holder
to the mapped (Java) name of the type.
For the basic IDL datatypes, the holder class name is the Java type name to which the datatype is mapped with an appended Holder
, e.g. IntHolder
. See Section 5.2, "Names" for a description of the implications on possible collisions with user defined names.
In order to support portable stubs and skeletons, holder classes for user defined types also have to implement the org.omg.CORBA.portable.Streamable
interface.
The holder classes for the basic types are defined below. Note that they do not implement the Streamable
interface. They are in the org.omg.CORBA
package.
// Java
package org.omg.CORBA;
final public class ShortHolder {
public short value;
public ShortHolder() {}
public ShortHolder(short initial) {
value = initial;
}
}
final public class IntHolder {
public int value;
public IntHolder() {}
public IntHolder(int initial) {
value = initial;
}
}
final public class LongHolder {
public long value;
public LongHolder() {}
public LongHolder(long initial) {
value = initial;
}
}
final public class ByteHolder {
public byte value;
public ByteHolder() {}
public ByteHolder(byte initial) {
value = initial;
}
}
final public class FloatHolder {
public float value;
public FloatHolder() {}
public FloatHolder(float initial) {
value = initial;
}
}
final public class DoubleHolder {
public double value;
public DoubleHolder() {}
public DoubleHolder(double initial) {
value = initial;
}
}
final public class CharHolder {
public char value;
public CharHolder() {}
public CharHolder(char initial) {
value = initial;
}
}
final public class BooleanHolder {
public boolean value;
public BooleanHolder() {}
public BooleanHolder(boolean initial) {
value = initial;
}
}
final public class StringHolder {
public java.lang.String value;
public StringHolder() {}
public StringHolder(java.lang.String initial) {
value = initial;
}
}
final public class ObjectHolder {
public org.omg.CORBA.Object value;
public ObjectHolder() {}
public ObjectHolder(org.omg.CORBA.Object initial) {
value = initial;
}
}
final public class AnyHolder {
public Any value;
public AnyHolder() {}
public AnyHolder(Any initial) {
value = initial;
}
}
final public class TypeCodeHolder {
public TypeCode value;
public typeCodeHolder() {}
public TypeCodeHolder(TypeCode initial) {
value = initial;
}
}
final public class PrincipalHolder {
public Principal value;
public PrincipalHolder() {}
public PrincipalHolder(TypeCode initial) {
value = initial;
}
}
The Holder class for a user defined type <foo> is shown below:// Java
final public class <foo>Holder
implements org.omg.CORBA.portable.Streamable {
public <foo> value;
public <foo>Holder() {}
public <foo>Holder(<foo> initial) {}
public void _read(org.omg.CORBA.portable.InputStream i)
{...}
public void _write(org.omg.CORBA.portable.OutputStream o)
{...}
public org.omg.CORBA.TypeCode _type() {...}
}
null
null
may only be used to represent the "null" object reference. For example, a zero length string, rather than null
must be used to represent the empty string. Similarly for arrays.true
and false
. chars
mapped from IDL chars when parameters are marshaled during method invocation. If the char
falls outside the range defined by ISO 8859.1, a CORBA::DATA_CONVERSION exception shall be thrown.
The IDL wchar maps to the Java primitive type char
.
byte
. java.lang.String
. Range checking for characters in the string as well as bounds checking of the string shall be done at marshal time. Character range violations cause a CORBA::DATA_CONVERSION exception to be raised. Bounds violations cause a CORBA:: MARSHAL exception to be raised.
The IDL wstring, both bounded and unbounded variants, are mapped to java.lang.String
. Bounds checking of the string shall be done at marshal time. Bounds violations cause a CORBA:: MARSHAL exception to be raised.
java.math.BigDecimal
class. Size violations raises a CORBA::DATA_CONVERSION exception.This is left for a future revision.
java.math.*
, possibly as java.math.BigFloat
.This is left for a future revision.
Helper
appended to the type name generated. Several static methods needed to manipulate the type are supplied. These include Any insert and extract operations for the type, getting the repository id, getting the typecode, and reading and writing the type from and to a stream.For any user defined IDL type, <typename>, the following is the Java code generated for the type. In addition, the helper class for a mapped IDL interface also has a narrow operation defined for it.
// generated Java helper
public class <typename>Helper {
public static void
insert(org.omg.CORBA.Any a, <typename> t) {...}
public static <typename> extract(Any a) {...}
public static org.omg.CORBA.TypeCode type() {...}
public static String id() {...}
public static <typename> read(
org.omg.CORBA.portable.InputStream istream)
{...}
public static void write(
org.omg.CORBA.portable.OutputStream ostream,
<typename> value)
{...}
// only for interface helpers
public static
<typename> narrow(org.omg.CORBA.Object obj);
}
The helper class associated with an IDL interface also has the narrow method (see Section 5.12, "Mapping for Interface).// IDL - named type
struct st {long f1; string f2;};
// generated Java
public class stHelper {
public static void insert(org.omg.CORBA.Any any,
st s) {...}
public static st extract(Any a) {...}
public static org.omg.CORBA.TypeCode type() {...}
public static String id() {...}
public static st read(org.omg.CORBA.InputStream is) {...}
public static void write(org.omg.CORBA.OutputStream os,
st s) {...}
}
// IDL - typedef sequence
typedef sequence <long> IntSeq;
// generated Java helper
public class IntSeqHelper {
public static void insert(org.omg.CORBA.Any any,
int[] seq);
public static int[] extract(Any a){...}
public static org.omg.CORBA.TypeCode type(){...}
public static String id(){...}
public static int[] read(
org.omg.CORBA.portable.InputStream is)
{...}
public static void write(
org.omg.CORBA.portable.OutputStream os,
int[] seq)
{...}
}
public static final
fields in the Java interface corresponding to the IDL interface.// IDL
module Example {
interface Face {
const long aLongerOne = -321;
};
};
// generated Java
package Example;
public interface Face {
public static final int aLongerOne = (int) (-321L);
}
public interface
with the same name as the constant and containing a public static final
field, named value
, that holds the contant's value. Note that the Java compiler will normally inline the value when the class is used in other Java code.// IDL
module Example {
const long aLongOne = -123;
};
package Example;
public interface aLongOne {
public static final int value = (int) (-123L);
}
final class
with the same name as the enum type which declares a value method, two static data members per label, an integer conversion method, and a private constructor as follows:// generated Java
public final class <enum_name> {
// one pair for each label in the enum
public static final int _<label> = <value>;
public static final <enum_name> <label> =
new <enum_name>(_<label>);
public int value() {...}
// get enum with specified value
public static <enum_name> from_int(int value
);
// constructor
private <enum_name>(int
) { ... }
}
One of the members is a public static final
that has the same name as the IDL enum label. The other has an underscore (_) prepended and is intended to be used in switch statements.
The value method returns the integer value. Values are assigned sequentially starting with 0. Note: there is no conflict with the value()
method in Java even if there is a label named value
There shall be only one instance of an enum. Since there is only one instance, pointer equality tests will work correctly.
The Java class for the enum has an additional method from_int()
, which returns the enum with the specified value.
The holder class for the enum is also generated. Its name is the enum's mapped Java classname with Holder
appended to it as follows:
public class <enum_name>Holder implements
org.omg.CORBA.portable.Streamable {
public <enum_name> value;
public <enum_name>Holder() {}
public <enum_name>Holder(<enum_name> initial) {...}
public void _read(org.omg.CORBA.portable.InputStream i)
{...}
public void _write(org.omg.CORBA.portable.OutputStream o)
{...}
public org.omg.CORBA.TypeCode _type() {...}
}
// IDL
enum EnumType {a, b, c};
// generated Java
public final class EnumType {
public static final int _a = 0;
public static final EnumType a = new EnumType(_a);
public static final int _b = 1;
public static final EnumType b = new EnumType(_b);
public static final int _c = 2;
public static final EnumType c = new EnumType(_c);
public int value() {...}
public static EnumType from_int(int value
) {...};
// constructor
private EnumType(int) {...}
};
The holder class for the struct is also generated. Its name is the struct's mapped Java classname with Holder
appended to it as follows:
final public class <class>Holder implements
org.omg.CORBA.portable.Streamable {
public <class> value;
public <class>Holder() {}
public <class>Holder(<class> initial) {...}
public void _read(org.omg.CORBA.portable.InputStream i)
{...}
public void _write(org.omg.CORBA.portable.OutputStream o)
{...}
public org.omg.CORBA.TypeCode _type() {...}
}
// IDL
struct StructType {
long field1;
string field2;
};
// generated Java
final public class StructType {
// instance variables
public int field1;
public String field2;
// constructors
public StructType() {}
public StructType(int field1, String field2)
{...}
}
final public class StructTypeHolder
implements org.omg.CORBA.portable.Streamable {
public StructType value;
public StructTypeHolder() {}
public StructTypeHolder(StructType initial) {...}
public void _read(org.omg.CORBA.portable.InputStream i)
{...}
public void _write(org.omg.CORBA.portable.OutputStream o)
{...}
public org.omg.CORBA.TypeCode _type() {...}
discriminator()
The branch accessor and modifier methods are overloaded and named after the branch. Accessor methods shall raise the CORBA::BAD_OPERATION system exception if the expected branch has not been set.
If there is more than one case label corresponding to a branch, the simple modifier method for that branch sets the discriminant to the value of the first case label. In addition, an extra modifier method which takes an explicit discriminator parameter is generated.
If the branch corresponds to the default case label, then the modifier method sets the discriminant to a value that does not match any other case labels.
It is illegal to specify a union with a default case label if the set of case labels completely covers the possible values for the discriminant. It is the responsibility of the Java code generator (e.g., the IDL complier, or other tool) to detect this situation and refuse to generate illegal code.
A default modifier method, named default()
( _default()
if name conflict) is created if there is no explicit default case label, and the set of case labels does not completely cover the possible values of the discriminant. It will set the value of the union to be an out-of-range value.
The holder class for the union is also generated. Its name is the union's mapped Java classname with Holder
appended to it as follows:
final public class <union_class>Holder
implements org.omg.CORBA.portable.Streamable {
public <union_class> value;
public <union_class>Holder() {}
public <union_class>Holder(<union_class> initial) {...}
public void _read(org.omg.CORBA.portable.InputStream i)
{...}
public void _write(org.omg.CORBA.portable.OutputStream o)
{...}
public org.omg.CORBA.TypeCode _type() {...}
}
// IDL
union UnionType switch (EnumType) {
case first: long win;
case second: short place;
case third:
case fourth: octet show;
default: boolean other;
};
// generated Java
final public class UnionType {
// constructor
public UnionType() {....}
// discriminator accessor
public <switch-type> discriminator() {....}
// win
public int win() {....}
public void win(int value) {....}
// place
public short place() {....}
public void place(short value) {....}
// show
public byte show() {....}
public void show(byte value) {....}
public void show(int discriminator, byte value){....}
// other
public boolean other() {....}
public void other(boolean value) {....}
}
final public class UnionTypeHolder
implements org.omg.CORBA.portable.Streamable {
public UnionType value;
public UnionTypeHolder() {}
public UnionTypeHolder(UnionType initial) {...}
public void _read(org.omg.CORBA.portable.InputStream i)
{...}
public void _write(org.omg.CORBA.portable.OutputStream o)
{...}
public org.omg.CORBA.TypeCode _type() {...}
}
The holder class for the sequence is also generated. Its name is the sequence's mapped Java classname with Holder
appended to it as follows:
final public class <sequence_class>Holder {
public <sequence_element_type>[]
value;
public <sequence_class>Holder() {};
public <sequence_class>Holder(
<sequence_element_type>[]
initial) {...};
public void _read(org.omg.CORBA.portable.InputStream i)
{...}
public void _write(org.omg.CORBA.portable.OutputStream o)
{...}
public org.omg.CORBA.TypeCode _type() {...}
}
// IDL
typedef sequence< long > UnboundedData;
typedef sequence< long, 42 > BoundedData;
// generated Java
final public class UnboundedDataHolder
implements org.omg.CORBA.portable.Streamable {
public int[]
value;
public UnboundedDataHolder() {};
public UnboundedDataHolder(int[]
initial) {...};
public void _read(org.omg.CORBA.portable.InputStream i)
{...}
public void _write(org.omg.CORBA.portable.OutputStream o)
{...}
public org.omg.CORBA.TypeCode _type() {...}
}
final public class BoundedDataHolder
implements org.omg.CORBA.portable.Streamable {
public int[]
value;
public BoundedDataHolder() {};
public BoundedDataHolder(int[]
initial) {...};
public void _read(org.omg.CORBA.portable.InputStream i)
{...}
public void _write(org.omg.CORBA.portable.OutputStream o)
{...}
public org.omg.CORBA.TypeCode _type() {...}
}
The holder class for the array is also generated. Its name is the array's mapped Java classname with Holder
appended to it as follows:
final public class <array_class>Holder
implements org.omg.CORBA.portable.Streamable {
public <array_element_type>[]
value;
public <array_class>Holder() {}
public <array_class>Holder(
<array_element_type>[]
initial) {...}
public void _read(org.omg.CORBA.portable.InputStream i)
{...}
public void _write(org.omg.CORBA.portable.OutputStream o)
{...}
public org.omg.CORBA.TypeCode _type() {...}
}
// IDL
const long ArrayBound = 42;
typedef long larray[ArrayBound];
// generated Java
final public class larrayHolder
implements org.omg.CORBA.portable.Streamable {
public int[]
value;
public larrayHolder() {}
public larrayHolder(int[]
initial) {...}
public void _read(org.omg.CORBA.portable.InputStream i)
{...}
public void _write(org.omg.CORBA.portable.OutputStream o)
{...}
public org.omg.CORBA.TypeCode _type() {...}
}
Helper
appended to the interface name. The Java interface extends the (mapped) base org.omg.CORBA.Object
interface.The Java interface contains the mapped operation signatures. Methods can be invoked on an object reference to this interface.
The helper class holds a static narrow method that allows a org.omg.CORBA.Object
to be narrowed to the object reference of a more specific type. The IDL exception CORBA::BAD_PARAM is thrown if the narrow fails.
There are no special "nil" object references. Java null
can be passed freely wherever an object reference is expected.
Attributes are mapped to a pair of Java accessor and modifier methods. These methods have the same name as the IDL attribute and are overloaded. There is no modifier method for IDL readonly attributes.
The holder class for the interface is also generated. Its name is the interface's mapped Java classname with Holder
appended to it as follows:
final public class <interface_class>Holder
implements org.omg.CORBA.portable.Streamable {
public <interface_class> value;
public <interface_class>Holder() {}
public <interface_class>Holder(
<interface_class> initial) {
value = initial;
public void _read(org.omg.CORBA.portable.InputStream i)
{...}
public void _write(org.omg.CORBA.portable.OutputStream o)
{...}
public org.omg.CORBA.TypeCode _type() {...}
}
Interface inheritance expressed in IDL is reflected directly in the Java interface hierarchy.// IDL
module Example {
interface Face {
long method (in long arg) raises (e);
attribute long assignable;
attribute readonly long nonassignable;
}
}
// generated Java
package Example;
public interface Face extends org.omg.CORBA.Object {
int method(int arg)
throws Example.e;
int assignable();
void assignable(int i);
int nonassignable();
}
public class FaceHelper {
// ... other standard helper methods
public static Face narrow(org.omg.CORBA.Object obj)
{...}
}
final public class FaceHolder
implements org.omg.CORBA.portable.Streamable {
public Face value;
public FaceHolder() {}
public FaceHolder(Face initial) {...}
public void _read(org.omg.CORBA.portable.InputStream i)
{...}
public void _write(org.omg.CORBA.portable.OutputStream o)
{...}
public org.omg.CORBA.TypeCode _type() {...}
}
IDL out and inout parameters, which implement call-by-result and call-by-value/result semantics, cannot be mapped directly into the Java parameter passing mechanism. This mapping defines additional holder classes for all the IDL basic and user-defined types which are used to implement these parameter modes in Java. The client supplies an instance of the appropriate holder Java class that is passed (by value) for each IDL out or inout parameter. The contents of the holder instance (but not the instance itself) are modified by the invocation, and the client uses the (possibly) changed contents after the invocation returns.
// IDL
module Example {
interface Modes {
long operation(in long inArg,
out long outArg,
inout long inoutArg);
};
};
// Generated Java
package Example;
public interface Modes {
int operation(int inArg,
IntHolder outArg,
IntHolder inoutArg);
}
In the above, the result comes back as an ordinary result and the actual in parameters only an ordinary value. But for the out and inout parameters, an appropriate holder must be constructed. A typical use case might look as follows:// user Java code
// select a target object
Example.Modes target = ...;
// get the in actual value
int inArg = 57;
// prepare to receive out
IntHolder outHolder = new IntHolder();
// set up the in side of the inout
IntHolder inoutHolder = new IntHolder(131);
// make the invocation
int result =target.operation(inArg, outHolder, inoutHolder);
// use the value of the outHolder
... outHolder.value ...
// use the value of the inoutHolder
... inoutHolder.value ...
Before the invocation, the input value of the inout parameter must be set in the holder instance that will be the actual parameter. The inout holder can be filled in either by constructing a new holder from a value, or by assigning to the value of an existing holder of the appropriate type. After the invocation, the client uses the outHolder.value to access the value of the out parameter, and the inoutHolder.value to access the output value of the inout parameter. The return result of the IDL operation is available as the result of the invocation.
CORBA system exceptions are unchecked exceptions. They inherit (indirectly) from java.lang.RuntimeException
.
User defined exceptions are checked exceptions. They inherit (indirectly) from java.lang.Exception
org.omg.CORBA.UserException
and are otherwise mapped just like the IDL struct type, including the generation of Helper and Holder classes.If the exception is defined within a nested IDL scope (essentially within an interface) then its Java class name is defined within a special scope. See Section 5.15, "Mapping for Certain Nested Types for more details. Otherwise its Java class name is defined within the scope of the Java package that corresponds to the exception's enclosing IDL module.
// IDL
module Example {
exception ex1 { string reason; };
};
// Generated Java
package Example;
final public class ex1 extends org.omg.CORBA.UserException {
public String reason; // instance
public ex1() {...} // default constructor
public ex1(String r) {...} // constructor
}
final public class ex1Holder
implements org.omg.CORBA.portable.Streamable {
public ex1 value;
public ex1Holder() {}
public ex1Holder(ex1 initial) {...}
public void _read(org.omg.CORBA.portable.InputStream i)
{...}
public void _write(org.omg.CORBA.portable.OutputStream o)
{...}
public org.omg.CORBA.TypeCode _type() {...}
}
org.omg.CORBA.SystemException
and provide access to the IDL major and minor exception code, as well as a string describing the reason for the exception.Note there are no public constructors for org.omg.CORBA.SystemException
; only classes that extend it can be instantiated.
The Java class name for each standard IDL exception is the same as its IDL name and is declared to be in the org.omg.CORBA
package. The default constructor supplies 0 for the minor code, COMPLETED_NO for the completion code, and "" for the reason string. There is also a constructor which takes the reason and uses defaults for the other fields, as well as one which requires all three parameters to be specified. The mapping from IDL name to Java class name is listed in the table below:
The definitions of the relevant classes are specified below.
// from org.omg.CORBA package
package org.omg.CORBA;
public final class CompletionStatus {
// Completion Status constants
public static final int _COMPLETED_YES = 0,
_COMPLETED_NO = 1,
_COMPLETED_MAYBE = 2;
public static final CompletionStatus COMPLETED_YES =
new CompletionStatus(_COMPLETED_YES);
public static final CompletionStatus COMPLETED_NO =
new CompletionStatus(_COMPLETED_NO);
public static final CompletionStatus COMPLETED_MAYBE =
new CompletionStatus(_COMPLETED_MAYBE);
public static final CompletionStatus from_int(int) {...}
private CompletionStatus(int) {...}
}
abstract public class
SystemException extends java.lang.RuntimeException {
public int minor;
public CompletionStatus completed;
// constructor
protected SystemException(String reason,
int minor,
CompletionStatus status) {
super(reason);
this.minor = minor;
this.status = status;
}
}
final public class
UNKNOWN extends org.omg.CORBA.SystemException {
public UNKNOWN() ...
public UNKNOWN(int minor, CompletionStatus completed) ...
public UNKNOWN(String reason) ...
public UNKNOWN(String reason, int minor,
CompletionStatus completed) ...
}
...
// there is a similar definition for each of the standard
// IDL system exceptions listed in the table above
org.omg.CORBA.Any
. This class has all the necessary methods to insert and extract instances of predefined types. If the extraction operations have a mismatched type, the CORBA::BAD_OPERATION exception is raised.In addition, insert and extract methods which take a holder class are defined in order to provide a high speed interface for use by portable stubs and skeletons. There is an insert and extract method defined for each primitive IDL type as well as a pair for a generic streamable to handle the case of non-prmitive IDL types. Note that to preserve unsigned type information unsigned methods (which use the normal holder class) are defined where appropriate.
The insert operations set the specified value and reset the any's type if necessary.
Setting the typecode via the type()
accessor wipes out the value. An attempt to extract before the value is set will result in a CORBA::BAD_OPERATION exception being raised. This operation is provided primarily so that the type may be set properly for IDL out parameters.
package org.omg.CORBA;
abstract public class Any {
abstract public boolean equal(org.omg.CORBA.Any);
// type code accessors
abstract public org.omg.CORBA.TypeCode type();
abstract public void type(org.omg.CORBA.TypeCode);
// read and write values to/from streams
// throw excep when typecode inconsistent with value
abstract public void read_value(
org.omg.CORBA.portable.InputStream,
org.omg.CORBA.TypeCode) throws org.omg.CORBA.MARSHAL;
abstract public void
write_value(org.omg.CORBA.portable.OutputStream);
abstract public org.omg.CORBA.portable.OutputStream
create_output_stream();
abstract public org.omg.CORBA.portable.InputStream
create_input_stream();
// insert and extract each primitive type
abstract public short extract_short()
throws org.omg.CORBA.BAD_OPERATION;
abstract public void insert_short(short);
abstract public int extract_long()
throws org.omg.CORBA.BAD_OPERATION;
abstract public void insert_long(int);
abstract public long extract_longlong()
throws org.omg.CORBA.BAD_OPERATION;
abstract public void insert_longlong(long);
abstract public short extract_ushort()
throws org.omg.CORBA.BAD_OPERATION;
abstract public void insert_ushort(short);
abstract public int extract_ulong()
throws org.omg.CORBA.BAD_OPERATION;
abstract public void insert_ulong(int);
abstract public long extract_ulonglong()
throws org.omg.CORBA.BAD_OPERATION;
abstract public void insert_ulonglong(long);
abstract public float extract_float()
throws org.omg.CORBA.BAD_OPERATION;
abstract public void insert_float(float);
abstract public double extract_double()
throws org.omg.CORBA.BAD_OPERATION;
abstract public void insert_double(double);
abstract public boolean extract_boolean()
throws org.omg.CORBA.BAD_OPERATION;
abstract public void insert_boolean(boolean);
abstract public char extract_char()
throws org.omg.CORBA.BAD_OPERATION;
abstract public void insert_char(char);
abstract public char extract_wchar()
throws org.omg.CORBA.BAD_OPERATION;
abstract public void insert_wchar(char);
abstract public byte extract_octet()
throws org.omg.CORBA.BAD_OPERATION;
abstract public void insert_octet(byte);
abstract public org.omg.CORBA.Any extract_any()
throws org.omg.CORBA.BAD_OPERATION;
abstract public void insert_any(org.omg.CORBA.Any);
abstract public org.omg.CORBA.Object extract_Object()
throws org.omg.CORBA.BAD_OPERATION;
abstract public void insert_Object(org.omg.CORBA.Object);
// throw excep when typecode inconsistent with value
abstract public void insert_Object(org.omg.CORBA.Object,
org.omg.CORBA.TypeCode) throws org.omg.CORBA.MARSHAL;
abstract public String extract_string()
throws org.omg.CORBA.BAD_OPERATION;
abstract public void insert_string(String);
abstract public String extract_wstring()
throws org.omg.CORBA.BAD_OPERATION;
abstract public void insert_wstring(String);
// insert and extract typecode
abstract public org.omg.CORBA.TypeCode extract_TypeCode()
throws org.omg.CORBA.BAD_OPERATION;
abstract public void insert_TypeCode(org.omg.CORBA.TypeCode);
// insert and extract Principal
abstract public org.omg.CORBA.Principal extract_Principal()
throws org.omg.CORBA.BAD_OPERATION;
abstract public void insert_Principal(
org.omg.CORBA.Principal);
// insert non-primitive IDL types
abstract public void insert_Streamable(
org.omg.CORBA.portable.Streamable);
}
IDL interfaces that contain these type declarations will generate a scope package to contain the mapped Java class declarations. The scope package name is constructed by appending Package
to the IDL type name.
// IDL
module Example {
interface Foo {
exception e1 {};
};
};
// generated Java
package Example.FooPackage;
final public class e1 extends org.omg.CORBA.UserException
{...}
The IDL types covered by this rule are described in Section 5.4, "Mapping for Basic Types.
Helper classes are generated for all typedefs.
Holder classes are generated for sequence and array typedefs only.
// IDL
struct EmpName {
string firstName;
string lastName;
};
typedef EmpName EmpRec;
// generated Java
// regular struct mapping for EmpName
// regular helper class mapping for EmpRec
final public class EmpName {
...
}
public class EmpRecHelper {
...
}